package com.baseweb.webadmin.core.model.bvo;

import com.baseweb.webadmin.core.constants.OrderPayStatus;
import com.baseweb.webadmin.core.constants.OrderStatus;
import com.baseweb.webadmin.core.model.pojo.ByUserBizProduct;
import com.baseweb.webadmin.core.model.pojo.ByUserOrder;
import com.baseweb.webadmin.core.model.pojo.User;
import com.baseweb.webadmin.core.util.DateUtil;
import org.joda.time.DateTime;

import java.math.BigDecimal;
import java.util.List;

public class OrderBvo {

    private Integer id;
    private Integer payType;
    private Integer payStatus;
    private Integer userId;
    private Integer bizUserId;
    private UserInfoBvo user;
    private UserInfoBvo bizUser;
    private Integer status;
    private DateTime createTime;
    private BigDecimal price;
    private BigDecimal deposit;
    private String descn;
    private Integer userStars;

    private String payStatusStr;
    private String statusStr;

    public static OrderBvo copyFrom(ByUserOrder order, User user, User bizUser) {
        OrderBvo bvo = new OrderBvo();
        bvo.setId(order.getId());
        bvo.setPayType(order.getPayType());
        bvo.setPayStatus(order.getPayStatus());
        bvo.setPayStatusStr(OrderPayStatus.getNameByCode(order.getPayStatus()).getName());
        bvo.setUserId(order.getId());
        bvo.setBizUserId(order.getBizUserId());
        bvo.setUser(UserInfoBvo.copyFrom(user, null, null));
        bvo.setBizUser(UserInfoBvo.copyFrom(bizUser, null, null));
        bvo.setStatus(order.getStatus());
        bvo.setStatusStr(OrderStatus.getNameByCode(order.getStatus()).getName());
        bvo.setCreateTime(order.getCreateTime());
        bvo.setPrice(order.getPrice());
        bvo.setDeposit(order.getDeposit());
        bvo.setDescn(order.getDescn());
        bvo.setUserStars(order.getUserStars());
        return bvo;
    }

    public Integer getUserStars() {
        return userStars;
    }

    public void setUserStars(Integer userStars) {
        this.userStars = userStars;
    }

    public String getPayStatusStr() {
        return payStatusStr;
    }

    public void setPayStatusStr(String payStatusStr) {
        this.payStatusStr = payStatusStr;
    }

    public String getStatusStr() {
        return statusStr;
    }

    public void setStatusStr(String statusStr) {
        this.statusStr = statusStr;
    }

    public BigDecimal getDeposit() {
        return deposit;
    }

    public void setDeposit(BigDecimal deposit) {
        this.deposit = deposit;
    }

    public String getDescn() {
        return descn;
    }

    public void setDescn(String descn) {
        this.descn = descn;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public Integer getPayType() {
        return payType;
    }

    public void setPayType(Integer payType) {
        this.payType = payType;
    }

    public Integer getPayStatus() {
        return payStatus;
    }

    public void setPayStatus(Integer payStatus) {
        this.payStatus = payStatus;
    }

    public Integer getUserId() {
        return userId;
    }

    public void setUserId(Integer userId) {
        this.userId = userId;
    }

    public Integer getBizUserId() {
        return bizUserId;
    }

    public void setBizUserId(Integer bizUserId) {
        this.bizUserId = bizUserId;
    }

    public UserInfoBvo getUser() {
        return user;
    }

    public void setUser(UserInfoBvo user) {
        this.user = user;
    }

    public UserInfoBvo getBizUser() {
        return bizUser;
    }

    public void setBizUser(UserInfoBvo bizUser) {
        this.bizUser = bizUser;
    }

    public Integer getStatus() {
        return status;
    }

    public void setStatus(Integer status) {
        this.status = status;
    }

    public DateTime getCreateTime() {
        return createTime;
    }

    public void setCreateTime(DateTime createTime) {
        this.createTime = createTime;
    }

    public BigDecimal getPrice() {
        return price;
    }

    public void setPrice(BigDecimal price) {
        this.price = price;
    }
}
